import request from '@/utils/request'

import { AxiosPromise } from 'axios'

enum Api {
  list = '/system/agent/station/dealer/list',
  save = '/system/agent/station/dealer/save',
  delete = '/system/agent/station/dealer/delete',
  batchDelete = '/system/agent/station/dealer/batchDelete',
  changeStatus = '/system/station/dealer/changeStatus',
}

// 列表
export function agentStationDealerList(query?: any): AxiosPromise<any> {
  return request({
    url: Api.list,
    method: 'post',
    data: query,
  })
}

// 编辑、保存
export const agentStationDealerSave = (data: any) => {
  return request({
    url: Api.save,
    method: 'post',
    data,
  })
}

// 删除
export function agentStationDealerDelete(id: string | Array<string>) {
  return request({
    url: Api.delete,
    method: 'post',
    data: id,
  })
}

// 批量删除
export const agentStationDealerBatchDelete = (data: (string | number)[]) => {
  return request({
    url: Api.batchDelete,
    method: 'post',
    data,
  })
}

// 状态修改
export function changeStatus(id: string | number, status: number) {
  const data = {
    id,
    status,
  }
  return request({
    url: Api.changeStatus,
    method: 'post',
    data,
  })
}
